// ============================================================================
//
// Copyright (C) 2006-2007 Dengues
//
// Google Group: http://groups.google.com/group/dengues
// QQ Group: 24885404
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ============================================================================
package org.dengues.designer.core.components;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.dengues.core.components.EJETCodePart;
import org.dengues.core.components.IComponentFilesNaming;
import org.dengues.core.components.IXMLComponent;

/**
 * Qiang.Zhang.Adolf@gmail.com class global comment. Detailled comment <br/>
 * 
 * $Id: Dengues.epf 1 2006-09-29 17:06:40Z qiang.zhang $
 * 
 */
public class ComponentFilesNaming implements IComponentFilesNaming {

    /**
     * Qiang.Zhang.Adolf@gmail.com ComponentFilesNaming constructor comment.
     */
    public ComponentFilesNaming() {
    }

    private static ComponentFilesNaming instance = new ComponentFilesNaming();

    public static ComponentFilesNaming getInstance() {
        return instance;
    }

    public String getMainXMLFileName(String componentName, String languageSuffix) {
        return componentName + "_" + languageSuffix + ".xml"; //$NON-NLS-1$ //$NON-NLS-2$
    }

    public List<String> getRequiredFilesNames(String componentName, String languageSuffix) {
        List<String> toReturn = new ArrayList<String>();
        toReturn.add(getPropertiesFileName(componentName));
        toReturn.add(getIcon32FileName(componentName));
        return toReturn;
    }

    public String getPropertiesFileName(String componentName) {
        return componentName + "_messages.properties"; //$NON-NLS-1$
    }

    public String getIcon32FileName(String componentName) {
        return componentName + "_icon32.png"; //$NON-NLS-1$
    }

    public String getIcon16FileName(String componentName) {
        return componentName + "_icon16.png"; //$NON-NLS-1$
    }

    public String getIcon24FileName(String componentName) {
        return componentName + "_icon24.png"; //$NON-NLS-1$
    }

    /**
     * Qiang.Zhang.Adolf@gmail.com Comment method "getBundleName".
     * 
     * @param innerFolder
     * @param componentName
     * @return
     */
    public String getBundleName(String innerFolder, String componentName) {
        String baseName = innerFolder.replace(File.separatorChar, '.');
        return baseName + "." + componentName + "." + componentName + "_messages"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.dengues.core.components.IComponentFilesNaming#getJetFileName(org.dengues.core.components.IComponent,
     * java.lang.String, org.dengues.core.components.ECodePart)
     */
    public String getJetFileName(IXMLComponent component, String languageSuffix, EJETCodePart codePart) {
        return component.getName() + "_" + codePart + "." + languageSuffix + "jet"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }

}
